﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ListarFuncionarios.aspx.cs" Inherits="WebApplication2.ListarFuncionarios" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">

</asp:Content>
<asp:Content ID="menu" runat="server" ContentPlaceHolderID="MainMenu">
		<ul>
        	<li><a href="Default.aspx">Inicio</a></li>
			<li  class="current_page_item"><a href="#">Gerenciar Funcionário</a></li>
			<li><a href="GerenciarProduto.aspx">Gerenciar Produto</a></li>
			<li><a href="GerarRelatorio.aspx">Gerar Relatórios</a></li>
		</ul>
</asp:Content>
<asp:Content ID="sideBar" runat="server" ContentPlaceHolderID="SideBar">
        <h2>Gerenciar Funcionario</h2>
        <ul>
        	<li><a href="GerenciarFuncionario.aspx">Cadastrar Funcionário</a></li>
            <li><a href="ListarFuncionarios.aspx">Listar Funcionários</a></li>						
		</ul>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <div id="post">    
        <h2>Lista de Funcionários</h2>
        
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
            DataKeyNames="id" DataSourceID="SqlDataSource2" 
            EmptyDataText="There are no data records to display." ForeColor="#333333" 
            GridLines="None" Height="19px" Width="613px"  
            >
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:BoundField DataField="nome" HeaderText="Nome" SortExpression="nome" />
                <asp:BoundField DataField="funcao" HeaderText="Função" 
                    SortExpression="funcao" />
                <asp:CommandField HeaderText="Delete" ShowDeleteButton="True" />
                <asp:CommandField HeaderText="Editar" 
                    ShowEditButton="True" />
            </Columns>
            <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
            <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
            <SortedAscendingCellStyle BackColor="#FDF5AC" />
            <SortedAscendingHeaderStyle BackColor="#4D0000" />
            <SortedDescendingCellStyle BackColor="#FCF6C0" />
            <SortedDescendingHeaderStyle BackColor="#820000" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:almoxarifadoConnectionString1 %>" 
            DeleteCommand="DELETE FROM [funcionario] WHERE [id] = @id" 
            InsertCommand="INSERT INTO [funcionario] ([nome], [funcao], [login], [senha]) VALUES (@nome, @funcao, @login, @senha)" 
            ProviderName="<%$ ConnectionStrings:almoxarifadoConnectionString1.ProviderName %>" 
            SelectCommand="SELECT [id], [nome], [funcao], [login], [senha] FROM [funcionario]" 
            UpdateCommand="UPDATE [funcionario] SET [nome] = @nome, [funcao] = @funcao, [login] = @login, [senha] = @senha WHERE [id] = @id">
            <DeleteParameters>
                <asp:Parameter Name="id" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="nome" Type="String" />
                <asp:Parameter Name="funcao" Type="String" />
                <asp:Parameter Name="login" Type="String" />
                <asp:Parameter Name="senha" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="nome" Type="String" />
                <asp:Parameter Name="funcao" Type="String" />
                <asp:Parameter Name="login" Type="String" />
                <asp:Parameter Name="senha" Type="String" />
                <asp:Parameter Name="id" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>

        
    </div>
</asp:Content>
